package com.ohs.ohsoa.system.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.ohs.ohsoa.system.dto.MeetingpersonsDto;
import com.ohs.ohsoa.system.entity.Meetingpersons;
import com.ohs.ohsoa.system.mapper.MeetingpersonsMapper;
import com.ohs.ohsoa.system.vo.MeetingpersonsVo;
import com.ohs.ohsoa.utils.bean.requestBean.PageParam;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MeetingpersonsServiceImpl extends ServiceImpl<MeetingpersonsMapper, Meetingpersons> implements MeetingpersonsService {

    @Resource
    private MeetingpersonsMapper meetingpersonsMapper;

    @Override
    public Boolean meetingPersonsInsert(List<Meetingpersons> meetingpersons){
        return this.saveBatch(meetingpersons);
    }

    @Override
    public List<MeetingpersonsVo> meetingSelectListByUserid(PageParam<MeetingpersonsDto> pageParam) {
        //获取对象
        MeetingpersonsDto meetingpersonsDto = pageParam.getSearchbean();
        //分页
        PageHelper.startPage(pageParam.getIndexPage(), pageParam.getPageSize());

        return  meetingpersonsMapper.meetingSelectListByUserid(meetingpersonsDto);
    }

    @Override
    public Integer meetingSelectCountIndex(MeetingpersonsDto meetingpersonsDto) {
        return meetingpersonsMapper.meetingSelectCountIndex(meetingpersonsDto.getUserinfoGuid());
    }

    @Override
    public Boolean meetingpersonsUpdateRead(MeetingpersonsDto meetingpersonsDto) {
        return meetingpersonsMapper.meetingpersonsUpdateRead(meetingpersonsDto);
    }

    @Override
    public Boolean meetingpersonsUpdateJoin(MeetingpersonsDto meetingpersonsDto) {
        if (meetingpersonsDto.getMpSureflg().equals("0") || meetingpersonsDto.getMpSureflg().equals("1")){
            meetingpersonsDto.setMpSureremark("");
        }
        return meetingpersonsMapper.meetingpersonsUpdateJoin(meetingpersonsDto);
    }
}
